package com.muyaxuan.mail.dao;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.muyaxuan.mail.dto.OrderItem;

public class OrderItemDao extends BaseDao{
	private static final String NAME_SPACE = "com.muyaxuan.mail.dto.OrderItem.";
	
	
	/**
	 * 根據訂單id查詢訂單詳情的方法
	 * @param id
	 * @return
	 */
	public List<OrderItem> getOrderItemById(int id){
		
		SqlSession session = getSqlSession();
		
		List<OrderItem> orderItemList = session.selectList(NAME_SPACE+"getOrderItemById",id);
		
		closeSqlSession();
		
		return orderItemList;
	}
	/**
	 * 删除订单详情
	 * @param id
	 */
	public void delete(int id){
        SqlSession session = getSqlSession();
		
		session.delete(NAME_SPACE+"delete",id);
		
		session.commit();
		
		closeSqlSession();
	}
	public void save(OrderItem orderItem){
        SqlSession session = getSqlSession();
		
		session.update(NAME_SPACE+"save",orderItem);
		
		session.commit();
		
		closeSqlSession();
	}
	
	

}
